<?php
if(command("lines")){
  $lineCount=0;
  $otherCount=0;
  $moduleCount=0;
  $controlCount=0;
  $disabledCount=0;
  foreach(dirlist("./",true) as $file){
    if(substr($file,strlen($file)-4)==".php"){
      $lineCount+=count(file($file));
      $otherCount++;
    }
  }
  foreach(dirlist("./modules/",true) as $file){
    if(substr($file,strlen($file)-4)==".php"){
      if(substr($file,10,1)!="_"){
        $lineCount+=count(file($file));
        $moduleCount++;
      } else {
        $moduleCount++;
        $disabledCount++;
      }
    }
  }
  foreach(dirlist("./controls/",true) as $file){
    if(substr($file,strlen($file)-4)==".php"){
      $lineCount+=count(file($file));
      $controlCount++;
    }
  }
  SendCommand("PRIVMSG $channel :Lines of PHP code used for $nickname: $lineCount [$moduleCount modules ($disabledCount disabled), $controlCount controls, and $otherCount other]");
}
if(command("modules")){
  $moduleList="";
  foreach(dirlist("./modules") as $file){
    if($file!=".." and substr($file,0,7)!="BACKUP_" and substr($file,0,8)!="_BACKUP_"){
      if(substr($file,0,1)=="_"){
        $moduleList.=", ".substr($file,1,strlen($file)-5)." (Disabled)";
      } else if(substr($file,0,2)=="z_"){
        $moduleList.=", ".substr($file,2,strlen($file)-6)." (LastLoad*)";
      } else {
        $moduleList.=", ".substr($file,0,strlen($file)-4);
      }
    }
  }
  $moduleList=trim($moduleList,", ");
  SendCommand("PRIVMSG $channel :Current modules: $moduleList");
}
?>